<template>
  <div class="foot">
    <van-tabbar route placeholder>
      <van-tabbar-item to="/layout/home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item to="/layout/contact" icon="contact"
        >会员</van-tabbar-item
      >
      <van-tabbar-item
        to="/layout/shopping"
        icon="shopping-cart-o"
        :badge="select"
        >购物车</van-tabbar-item
      >
      <van-tabbar-item to="/layout/search" icon="search">搜索</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import { getUserId } from "../../utils/locaIdata";
import eventBus from "../../utils/eventBus";

export default {
  data() {
    return {
      active: 0,
      select: 0,
      goodsData: [],
    };
  },
  created() {
    // 获取本地数据;
    this.goodsData = getUserId();
    console.log("我不是黄蓉", this.goodsData);
    this.goodsData = this.goodsData.reduce((total, item) => {
      return (total += item.coust);
    }, 0);
    eventBus.$on("Mybottom", (count) => {
      this.select = count;
    });
  },
};
</script>

<style lang="less" scoped>
</style>